import java.util.ArrayList;
import java.util.LinkedList;
import java.util.ListIterator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏西西
 * Date: 2023-11-01
 * Time: 8:54
 */
public class Test {
    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<>();
        list.add(11);
        list.add(12);
        list.add(13);

        ArrayList<Number> arrayList1 = new ArrayList<>(list);
        arrayList1.add(1);
        arrayList1.add(0,10);
        arrayList1.add(1,10);

        arrayList1.remove(new Integer(10));
        System.out.println(arrayList1.get(0));
        System.out.println(arrayList1);
        arrayList1.clear();
        System.out.println(arrayList1);
        System.out.println("====");
        //遍历
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i)+" ");
        }
        System.out.println();
        System.out.println("=======");
        for (Integer x:
             list) {
            System.out.print(x +" ");
        }
        System.out.println();
        System.out.println("======");
        ListIterator<Integer> it = list.listIterator();
        while (it.hasNext()){
            System.out.print(it.next()+" ");
        }
    }
}
